library(ggmap)
## Loading required package: ggplot2
library(mapproj)
## Loading required package: maps
map_1 <- get_map(location = c(lon = 120.233937, lat = 22.993013), zoom = 5)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=22.993013,120.233937&zoom=5&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_1)
map_2 <- get_map(location = c(lon = 121.564472, lat = 25.033964),
zoom = 18, language = "zh-TW", maptype = "roadmap")
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.033964,121.564472&zoom=18&size=640x640&scale=2&maptype=roadmap&language=zh-TW&sensor=false
ggmap(map_2)
map_3 <- get_map(location = c(lon = 121.564472, lat = 25.033964),
zoom = 18, language = "zh-TW", maptype = "satellite")
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.033964,121.564472&zoom=18&size=640x640&scale=2&maptype=satellite&language=zh-TW&sensor=false
ggmap(map_3)
library(readr)
bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## 郵遞區號 = col_integer(),
## 經度 = col_double(),
## 緯度 = col_double(),
## 點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg
library(ggmap)
map_4 <- get_map(location = c(lon = 120.5, lat = 23.625), zoom = 8)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=23.625,120.5&zoom=8&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_4) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 35 rows containing missing values (geom_point).
library(readr)
bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## 郵遞區號 = col_integer(),
## 經度 = col_double(),
## 緯度 = col_double(),
## 點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg
library(ggmap)
map_4 <- get_map(location = c(lon = 120.5, lat = 23.625), zoom = 8)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=23.625,120.5&zoom=8&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_4) + geom_point(aes(x = lon, y = lat, size = "點閱數"), data = bs)
## Warning: Using size for a discrete variable is not advised.
## Warning: Removed 35 rows containing missing values (geom_point).
ggmap(map_4, darken = c(0.5, "white")) +
geom_point(aes(x = lon, y = lat, size = "點閱數"), data = bs)
## Warning: Using size for a discrete variable is not advised.
## Warning: Removed 35 rows containing missing values (geom_point).
library(readr)
bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## 郵遞區號 = col_integer(),
## 經度 = col_double(),
## 緯度 = col_double(),
## 點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg
library(ggmap)
map_5 <- get_map(location = c(lon = 121.576957, lat = 25.028702), zoom = 15)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.028702,121.576957&zoom=15&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_5) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 158 rows containing missing values (geom_point).
library(readr)
bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## 郵遞區號 = col_integer(),
## 經度 = col_double(),
## 緯度 = col_double(),
## 點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg
library(ggmap)
map_6 <- get_map(location = c(lon = 121.519872, lat =25.042141), zoom = 13)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.042141,121.519872&zoom=13&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_6) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 109 rows containing missing values (geom_point).
library(readr)
bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## 郵遞區號 = col_integer(),
## 經度 = col_double(),
## 緯度 = col_double(),
## 點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg
library(ggmap)
map_5 <- get_map(location = c(lon = 121.542709, lat = 25.026158), zoom = 15)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.026158,121.542709&zoom=15&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_5) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 129 rows containing missing values (geom_point).
library(readr)
bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
## .default = col_character(),
## 郵遞區號 = col_integer(),
## 經度 = col_double(),
## 緯度 = col_double(),
## 點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg
library(ggmap)
map_6 <- get_map(location = c(lon = 120.673648, lat =24.147736), zoom = 14)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=24.147736,120.673648&zoom=14&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_6) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 148 rows containing missing values (geom_point).
資料來源:政府資料開放平台https://data.gov.tw/dataset/6224